<?php
require_once('Triples.class.php');
require_once('GraphIndex.class.php');
/**
 * RDFXML - class encapsulating RDFXML, 
 * with methods for converting it to other data structures
 *
 * @package converters
 * @author Keith Alexander
 **/
class RDFXML extends ConvertableObject
{
	/**
	 * returns a Triples object
	 *
	 * @return object Triples
	 * @author Keith Alexander
	 **/
	public function to_triples($rdfxml, $base='')
	{
		$parser = ARC2::getRDFXMLParser(); 
		$parser->parse($base, trim($rdfxml)); 
		$triples = $parser->getTriples();
		$Triples = new Triples();
		$Triples->set_value($triples);
		return $Triples;
	}
	
	/**
	 * returns a GraphIndex object
	 *
	 * @return object GraphIndex
	 * @author Keith Alexander
	 **/
	public function to_resources($rdfxml, $base='')
	{
		$parser = ARC2::getRDFXMLParser(); 
		$parser->parse($base, trim($rdfxml)); 
		$index = $parser->getSimpleIndex(0);
		return new GraphIndex($index, $this->containerObject);
	}
	
}

?>